/*
 * @Author: JPeng 872639397@qq.com
 * @Date: 2022-05-16 10:37:02
 * @LastEditors: JPeng 872639397@qq.com
 * @LastEditTime: 2022-05-16 11:38:53
 * @FilePath: \review-review-review\复习！！！\Ajax\express.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const { response } = require("express");
const express = require("express");
const { request } = require("http");

const app = express();

app.get('/server', (request, response) => {
    response.setHeader('Access-Control-Allow-Origin', '*');
    response.send("吃饭了吗");
})

app.post('/postserver', (request, response) => {
    response.setHeader('Access-Control-Allow-Origin', '*');
    const str = {
        a : 3000,
    }
    setTimeout(() => {
        response.send(JSON.stringify(str));
    },3000)
    
})

app.listen(8000, () => {
    console.log("服务启动咯");
})